﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Acoris.Diagnostics
{
    /// <summary>
    /// 
    /// </summary>
    internal class DiagnosticFrameFactory
    {
        static Stack<DiagnosticFrame> _stack;
        static DiagnosticFrameFactory()
        {
            _stack = new Stack<DiagnosticFrame>();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static void StartNewFrame(ActionType type)
        {
            _stack.Push(new DiagnosticFrame(type, DateTime.Now.Ticks));
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static DiagnosticFrame EndFrame()
        {
            var frame = _stack.Pop();
            frame.EndProcess();
            return frame;
        }
    }
}
